<?php
class Bbling_Model_Entity_News extends Evebit_Model_Abstract {
	
	protected $_resourceName = "Bbling_Model_Resource_News";
	
	protected $_resourceCollectionName = "Bbling_Model_Collection_News";
	
    protected function _afterLoad() {
		return $this;
	}
	
	/**
	 * (non-PHPdoc)
	 * @see Evebit_Model_Abstract::_beforeSave()
	 */
	protected function _beforeSave() {	
		return $this;
	}
	/**
	 * (non-PHPdoc)
	 * @return Evebit_Model_Abstract::_beforeDelete()
	 */
	protected function _beforeDelete() {
		return $this;
	}

	public function getAllNews(){
		$collection = $this->getCollection();
		$collection->addFieldToFilter('main_table.select_published', 1);
		$collection->addOrder('main_table.order','asc');
		$items = $collection->getItems();
		return $items;
	}
	
    public function getFormField($tableName) {
		$fileds = parent::getFormField ( $tableName );
		foreach ( $fileds as $key => $filed ) {
			switch ($key) {
				case 'select_published' :
					$fileds [$key] ['data'] = array('Unpublished','Published');
					break;
			}
		}
		return $fileds;
	}
}